package com.onlyphoto.onlymall.mvp.model

import com.onlyphoto.onlymall.api.Urls
import com.onlyphoto.onlymall.base.BaseModel
import com.onlyphoto.onlymall.base.BaseObserver
import com.onlyphoto.onlymall.bean.response.WxPayParamsBean
import com.onlyphoto.onlymall.utils.ConfigUtil
import com.onlyphoto.onlymall.utils.RxTransformer


class MPayMethodImpl : BaseModel() {
    var url = ""
    fun getWxPayParams(orderId: String, baseObserver: BaseObserver<WxPayParamsBean>) {
        url = ConfigUtil.instance.getUrl(Urls.WXPAY)
        apiService().wxPay(url, orderId)
                .compose(RxTransformer.switchSchedulers(this))
                .subscribe(baseObserver)
    }
    fun getAliPayParams(orderId: String, baseObserver: BaseObserver<String>) {
        url = ConfigUtil.instance.getUrl(Urls.AliPAY)
        apiService().aliPay(url, orderId)
                .compose(RxTransformer.switchSchedulers(this))
                .subscribe(baseObserver)
    }
}
